<template>
	<view class="content">
		<!-- <uv-navbar leftIcon="arrow-leftward" title="商品详情" leftIconColor="#333" placeholder autoBack bgColor="#fff" :titleStyle="titleStyle" rightIcon="share-fill">
		
		</uv-navbar> -->
		<navbar title='商品详情'>
		</navbar>
		<view class="done">
			<u-swiper :list="swlist" border-radius="0" height="740" radius="0" indicatorMode="dot"></u-swiper>
		</view>
		<view class="dtwo">
			<text class="dname">{{ info.name }}</text>
			<view class="jian" v-if="info.synopsis">
				{{info.synopsis}}
			</view>
			<view class="downview">
				<text class="xname">下载价格：</text>
				<text class="jnum">￥<text class="jnums">{{info.price}}</text></text>
				<image class="icon_fx" src="@/static/new/icon_fx.png"></image>
				<text class="yixia">已下载：<text class="xianum">{{info.download}}</text></text>
			</view>
		</view>
		<view class="botview">
			<view class="botleft">
				<text class="shifu">实付：<text class="shinum">￥<text class="nums">{{info.price}}</text> </text></text>
				<text class="mtit">加入会员免费下载</text>
				
			</view>
			<view class="goumai" style="margin-left: auto;" v-if="is_buy ==1" @click="getdownload">下载</view>
			<view class="kaihui" v-if="is_buy !=1" @click="gethuiyuan">开通会员</view>
			<view class="goumai" v-if="is_buy !=1" @click="getxiadan">直接购买</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				titleStyle:{
					fontWeight: 'bold',
					fontSize: '36rpx',
					color: '#111111',
				},
				value:'',
				swlist:[
				// 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
				// 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
				// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				],
				id:'',
				info:{

				},
				is_buy:0

			}
		},
		onLoad(option) {
			this.id = option.id
			this.getDetail()
		},
		onShow() {
		},
		methods: {
			async getDetail(){
				let res = await this.$u.api.contractinfo({
					id:this.id
				});
				this.info = res.info
				this.is_buy = res.is_buy
				let swlist = []
				swlist.push(this.info.img)
				this.swlist = swlist
			},
			gethuiyuan(){
				this.navrouter("/pages/TPage/VIpServices");
			},
			async getxiadan(){
				let res = await this.$u.api.orderplace({
					type:'2',
					id:this.id
				});
				this.$u.toast("操作成功");
			},
			getdownload(){
				// #ifdef H5
				location.href = this.info.download_url
				// #endif
				// #ifdef APP-PLUS
				this.navrouter("/pages/TPage/webview?url="+encodeURIComponent(this.info.download_url));
				// #endif
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		min-height: 100vh;
		background-color: #f5f5f5;
		padding-bottom: 130rpx;
		.dtwo{
			background-color: #fff;
			padding: 30rpx;
			.dname{
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 34rpx;
				color: #333333;

			}
			.jian{
				background: #F8F8F8;
				padding: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #999999;
				margin: 30rpx 0;
				line-height: 40rpx;
			}
			.downview{
				display: flex;
				flex-direction: row;
				align-items: center;
				.xname{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #999999;
				}
				.jnum{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #E53E3E;
					position: relative;
					top: -5rpx;
				}
				.jnums{
					font-size: 44rpx;
				}
				.icon_fx{
					margin-left: auto;
					width: 33rpx;
					height: 33rpx;
					margin-right: 10rpx;
				}
				.yixia{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #999999;
				}
				.xianum{
					color: #333333;
				}

			}
		}
		.botview{
			position: fixed;
			width: 100%;
			height: 120rpx;
			background: #FFFFFF;
			bottom: 0;
			// padding: 0 30rpx;
			display: flex;
			align-items: center;
			.botleft{
				display: flex;
				flex-direction: column;
				margin-left: 20rpx;
				.shifu{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #999999;
				}
				.shinum{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #E53E3E;
				}
				.nums{
					font-size: 44rpx;
				}
				.mtit{
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #999999;
					display: block;
					margin-top: 10rpx;
				}
				
			}
			.kaihui{
				width: 200rpx;
				height: 78rpx;
				background: linear-gradient(90deg, #F4DAB5, #E7B775);
				border-radius: 10rpx;
				display: flex;
				margin-left: auto;
				align-items: center;
				justify-content: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #52360F;
			}
			.goumai{
				width: 200rpx;
				height: 78rpx;
				background: #3E65E5;
				border-radius: 10rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #fff;
				margin: 0 20rpx 0;
			}
		}

	}
</style>